<template>
  <div class="run-container">
    <div class="run-core">
      <el-card class="run-card">



        <el-table :data="page.records" stripe style="width: 100%">
          <el-table-column prop="id" label="编号" min-width="11%" align="center"></el-table-column>
          <el-table-column prop="position" label="岗位" min-width="9%" align="center"></el-table-column>
          <el-table-column prop="basePay" label="基本薪资" min-width="10%" align="center"></el-table-column>
          <el-table-column prop="yearStr" label="年限" min-width="10%" align="center"></el-table-column>
          <el-table-column prop="bonus" label="奖金" min-width="10%" align="center"></el-table-column>
          <el-table-column prop="tax" label="缴税金额" min-width="10%" align="center"></el-table-column>
          <el-table-column prop="createTime" label="创建时间" min-width="10%" align="center"></el-table-column>
          <el-table-column prop="username" label="创建人" min-width="10%" align="center"></el-table-column>

          <el-table-column label="操作" min-width="20%" align="center">
            <template slot-scope="scope">
              <el-button  type="danger" @click="del(scope.row.id)"  size="mini">删除</el-button>
            </template>
          </el-table-column>
        </el-table>

        <el-pagination background layout="prev, pager, next"
                       :total="page.total" class="recruit-page"
                       :current-page="current" :page-size="page.size" style="margin:1rem 45%" @current-change="pagePayOrg">
        </el-pagination>

      </el-card>




    </div>
  </div>
</template>

<script>


import {delOrgPay, pageOrgPay} from "@/api/pay";

export default {
  data(){
    return{
      current:1,
      pageSize:10,
      search:{},
      page:{}
    }
  },




  methods: {
    async pagePayOrg(index){
      if (typeof(index) == 'undefined'){
        index = this.current
      }
      const {data:res} = await pageOrgPay(index,this.pageSize,this.search)
      this.page = res.data
    },
    async del(id){
      const res = await delOrgPay(id)
      if (res.code === 200){
        this.$message({message: "删除成功", type: 'success'});
      }
      await this.pagePayOrg(1)
    }
  },


  created() {
    this.pagePayOrg()
  }


}
</script>

<style lang="scss" scoped>
.run{
  &-core{
    margin:0 2rem 0 2rem;
  }
  &-card{
    margin-top: 2rem;
  }

}
</style>

<style scoped>



</style>
